package com.amumu.netctoss.action;

import java.io.InputStream;

import com.amumu.netctoss.util.CheckCodeUtil;

@SuppressWarnings("serial")
public class CheckCodeAction extends BaseAction{
	private InputStream inputStream;
	private String checkCode;

	public void setCheckCode(String checkCode) {
		this.checkCode = checkCode;
	}

	public InputStream getInputStream() {
		return inputStream;
	}

	public void setInputStream(InputStream inputStream) {
		this.inputStream = inputStream;
	}
	
	public String verify(){
		if(checkCode!=null && checkCode.equalsIgnoreCase(session.get("check_code").toString())){
			ok = true;
		}
		//System.out.println("code:"+checkCode);
		return SUCCESS;
	}
	
	@Override
	public String execute(){
		CheckCodeUtil util = new CheckCodeUtil();
		session.put("check_code", util.getCode());
		inputStream = util.getInputStream();
		return SUCCESS;
	}
}
